<!DOCTYPE html>
<html class="client-nojs vector-feature-night-mode-disabled vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-sticky-header-enabled" lang="en" dir="ltr"><head>
<meta charset="UTF-8">
<title>Image map</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://en.wikipedia.org/wiki/Image_map"> <link href="./mw/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/ext.pygments.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/user.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./mw/site.styles.css">
<link rel="stylesheet" type="text/css" href="./mw/noscript.css">
<link rel="stylesheet" type="text/css" href="./footer.css">
<link rel="stylesheet" type="text/css" href="./vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Image_map rootpage-Image_map skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading">
<span id="openzim-page-title" class="mw-page-title-main"><span class="mw-page-title-main">Image map</span></span>
</h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr">
<style data-mw-deduplicate="TemplateStyles:r1251242444">
/* start https://en.wikipedia.org/ */
.mw-parser-output .ambox{border:1px solid #a2a9b1;border-left:10px solid #36c;background-color:#fbfbfb;box-sizing:border-box}.mw-parser-output .ambox+link+.ambox,.mw-parser-output .ambox+link+style+.ambox,.mw-parser-output .ambox+link+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+style+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+link+.ambox{margin-top:-1px}html body.mediawiki .mw-parser-output .ambox.mbox-small-left{margin:4px 1em 4px 0;overflow:hidden;width:238px;border-collapse:collapse;font-size:88%;line-height:1.25em}.mw-parser-output .ambox-speedy{border-left:10px solid #b32424;background-color:#fee7e6}.mw-parser-output .ambox-delete{border-left:10px solid #b32424}.mw-parser-output .ambox-content{border-left:10px solid #f28500}.mw-parser-output .ambox-style{border-left:10px solid #fc3}.mw-parser-output .ambox-move{border-left:10px solid #9932cc}.mw-parser-output .ambox-protection{border-left:10px solid #a2a9b1}.mw-parser-output .ambox .mbox-text{border:none;padding:0.25em 0.5em;width:100%}.mw-parser-output .ambox .mbox-image{border:none;padding:2px 0 2px 0.5em;text-align:center}.mw-parser-output .ambox .mbox-imageright{border:none;padding:2px 0.5em 2px 0;text-align:center}.mw-parser-output .ambox .mbox-empty-cell{border:none;padding:0;width:1px}.mw-parser-output .ambox .mbox-image-div{width:52px}@media(min-width:720px){.mw-parser-output .ambox{margin:0 10%}}@media print{body.ns-0 .mw-parser-output .ambox{display:none!important}}
/* end https://en.wikipedia.org/ */
</style>
<p>In <a href="HTML" title="HTML">HTML</a> and <a href="XHTML" title="XHTML">XHTML</a>, an <b>image map</b> is a list of coordinates relating to a specific <a href="Image" title="Image">image</a>, created in order to <a href="Hyperlink" title="Hyperlink">hyperlink</a> areas of an <a href="Digital_image" title="Digital image">image</a> to different destinations (as opposed to a normal image link, in which the entire area of the image links to a single destination). For example, a map of the world may have each country hyperlinked to further information about that country. The intention of an image map is to provide an easy way of linking various parts of an image without dividing the image into separate image files.
</p>
<meta property="mw:PageProp/toc">
<div class="mw-heading mw-heading2"><h2 id="Server-side">Server-side</h2></div>
<p><b>Server-side image maps</b> were first supported in <a href="Mosaic_(web_browser)" class="mw-redirect" title="Mosaic (web browser)">Mosaic (web browser)</a> version 1.1.<sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup> Server-side image maps enable the <a href="Web_browser" title="Web browser">web browser</a> to send positional information to the server about where the user clicks within an image. This allows the server to make pixel-by-pixel decisions about what content to return in response (possible methods are to use image mask layers, database queries, or configuration files on the server).
</p><p>The <a href="HTML" title="HTML">HTML</a> code for this type of server-side image map requires the <code><img></code> tag to be inside an anchor tag <code><a>...</a></code> and the <code><img></code> must include the <code>ismap</code> attribute.
</p>
<div class="mw-highlight mw-highlight-lang-html mw-content-ltr" dir="ltr"><pre><span class="p"><</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">"/imagemapper"</span><span class="p">><</span><span class="nt">img</span> <span class="na">src</span><span class="o">=</span><span class="s">"image.png"</span> <span class="na">ismap</span> <span class="p">/></</span><span class="nt">a</span><span class="p">></span>
</pre></div>
<p>When the user clicks inside the image the browser will append the X and Y coordinates (relative to the upper-left corner of the image) to the anchor <a href="URL" title="URL">URL</a> as a <a href="Query_string" title="Query string">query string</a> and will access the resulting <a href="URL" title="URL">URL</a><sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup> (for example, <code>/imagemapper?3,9</code>).
</p><p>If the browser does not support <code>ismap</code> then the <a href="Query_string" title="Query string">query string</a> must not be added to the anchor <a href="URL" title="URL">URL</a> and the server should respond appropriately (for example, by returning a text-only navigation page).
</p>
<div class="mw-heading mw-heading2"><h2 id="Client-side">Client-side</h2></div>
<p><b>Client-side image maps </b>were introduced in <a href="HTML_3.2" class="mw-redirect" title="HTML 3.2">HTML 3.2</a>, and do not require any special logic to be executed on the server (they are fully client-side). They also do not require any <a href="JavaScript" title="JavaScript">JavaScript</a>.
</p>
<div class="mw-heading mw-heading3"><h3 id="Pure_HTML">Pure HTML</h3></div>
<p>A client-side imagemap in HTML consists of two parts:
</p>
<ol><li>the actual image, which is embedded with the <code><img></code> tag. The image tag must have an attribute <i>usemap,</i> which names the imagemap to use for this image (multiple imagemaps may exist on a single page).</li>
<li>A <code><map></code> element, and inside that, <code><area></code> elements, each of which defines a single clickable area within the imagemap. These are similar to the <code><a> tag</code> defining which <a href="Uniform_Resource_Locator" class="mw-redirect" title="Uniform Resource Locator">URL</a> should be opened for an ordinary web link. A <code>title</code> attribute may be provided, which may be rendered as a <a href="Tooltip" title="Tooltip">tooltip</a> if a desktop user hovers their mouse pointer over the area. For <a href="Web_accessibility" title="Web accessibility">web accessibility</a> reasons, it is often important – and in some cases it may even be a legal or contractual requirement – to provide an <code>alt</code> attribute describing the link that <a href="Screen_reader" title="Screen reader">screen reader</a> software can read to, for example, <a href="Blindness" class="mw-redirect" title="Blindness">blind</a> users.<sup id="cite_ref-access-ability_3-0" class="reference"><a href="#cite_note-access-ability-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup></li></ol>
<p>The <code><area></code> elements can be rectangles (<code>shape="rect"</code>), polygons (<code>shape="poly"</code>) or circles (<code>shape="circle"</code>).
Shape-Values are coordinate-pairs. Every pair has an X and a Y value (from left/top of an image) and is separated with a comma.
</p>
<ul><li>Rectangle: Set four coordinates: "x1,y1,x2,y2"</li>
<li>Polygon: Set as many coordinates as desired (a multiple of two): "x1,y1,x2,y2, [...] xn,yn"</li>
<li>Circle: One coordinate-pair and another value with a radius: "x1,y1,radius"</li></ul>
<p>The following example defines a rectangular area ("9,372,66,397"). When a user clicks anywhere inside this area, they are taken to the <a href="English_Wikipedia" title="English Wikipedia">English Wikipedia</a>'s home page.
</p>
<div class="mw-highlight mw-highlight-lang-html mw-content-ltr" dir="ltr"><pre><span class="p"><</span><span class="nt">img</span> <span class="na">src</span><span class="o">=</span><span class="s">"image.png"</span> <span class="na">alt</span><span class="o">=</span><span class="s">"Website map"</span> <span class="na">usemap</span><span class="o">=</span><span class="s">"#mapname"</span> <span class="p">/></span>
<span class="p"><</span><span class="nt">map</span> <span class="na">name</span><span class="o">=</span><span class="s">"mapname"</span><span class="p">></span>
<span class="p"><</span><span class="nt">area</span> <span class="na">shape</span><span class="o">=</span><span class="s">"rect"</span> <span class="na">coords</span><span class="o">=</span><span class="s">"9,372,66,397"</span> <span class="na">href</span><span class="o">=</span><span class="s">"https://en.wikipedia.org/"</span> <span class="na">alt</span><span class="o">=</span><span class="s">"Wikipedia"</span> <span class="na">title</span><span class="o">=</span><span class="s">"Wikipedia"</span> <span class="p">/></span>
<span class="p"></</span><span class="nt">map</span><span class="p">></span>
</pre></div>
<div class="mw-heading mw-heading3"><h3 id="CSS">CSS</h3></div>
<p>A more recent approach is to overlay links on an image using <a href="CSS" title="CSS">CSS</a> absolute positioning; however, this only supports rectangular clickable areas. This CSS technique may be suitable for making an image map work properly on <a href="IPhones" class="mw-redirect" title="IPhones">iPhones</a>, which can fail to rescale pure HTML image maps correctly.
</p>
<div class="mw-heading mw-heading2"><h2 id="Creation_and_use">Creation and use</h2></div>
<p>It is possible to create client-side image maps by hand using a text editor, but doing so requires web designers to know how to code HTML as well as how to enumerate the coordinates of the areas they wish to place over the image. As a result, most image maps coded by hand are simple polygons.
</p><p>Because creating image maps in a text editor requires much time and effort, many applications have been designed to allow web designers to create image maps quickly and easily, much as they would create shapes in a <a href="Vector_graphics_editor" title="Vector graphics editor">vector graphics editor</a>.
</p><p>Image maps which do not make their clickable areas obvious risk subjecting the user to <a href="Mystery_meat_navigation" title="Mystery meat navigation">mystery meat navigation</a>. Even when they do, where they lead may not be obvious. This can be partially remedied with rollover effects.<sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading2"><h2 id="SVG_images">SVG images</h2></div>
<p>Because the <a href="Scalable_Vector_Graphics" class="mw-redirect" title="Scalable Vector Graphics">Scalable Vector Graphics</a> (SVG) image format provides its own mechanisms for adding hyperlinks<sup id="cite_ref-5" class="reference"><a href="#cite_note-5"><span class="cite-bracket">[</span>5<span class="cite-bracket">]</span></a></sup> and other, more sophisticated forms of interactivity<sup id="cite_ref-6" class="reference"><a href="#cite_note-6"><span class="cite-bracket">[</span>6<span class="cite-bracket">]</span></a></sup> to images, traditional image map techniques are generally not necessary when working with vector images in the SVG format.
</p>
<div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div>
<ul><li><a href="Mystery_meat_navigation" title="Mystery meat navigation">Mystery meat navigation</a></li></ul>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1239543626">
/* start https://en.wikipedia.org/ */
.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}
/* end https://en.wikipedia.org/ */
</style><div class="reflist">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-1">^</a></b></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">
/* start https://en.wikipedia.org/ */
.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("./mw/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("./mw/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("./mw/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("./mw/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}
/* end https://en.wikipedia.org/ */
</style><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://1997.webhistory.org/www.lists/www-talk.1993q2/0343.html">"IMG extension for Mosaic 1.1"</a>.</cite></span>
</li>
<li id="cite_note-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-2">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://www.w3.org/TR/html-markup/">"HTML: The Markup Language (an HTML language reference)"</a>.</cite></span>
</li>
<li id="cite_note-access-ability-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-access-ability_3-0">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://accessibility.psu.edu/imagemaps">"Image Maps in HTML"</a>. <i>AccessAbility</i>. <a href="Penn_State_University" class="mw-redirect" title="Penn State University">Penn State University</a><span class="reference-accessdate">. Retrieved <span class="nowrap">6 October</span> 2013</span>.</cite></span>
</li>
<li id="cite_note-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-4">^</a></b></span> <span class="reference-text"><cite id="CITEREFFlanders1998" class="citation book cs1">Flanders, Vincent (March 1998). <span class="id-lock-registration" title="Free registration required"><a rel="nofollow" class="external text" href="https://archive.org/details/webpagesthatsuck00flan"><i>Web Pages That Suck: Learn Good Design by Looking at Bad Design</i></a></span>. San Francisco: Sybex Inc. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <bdi>978-0-7821-2187-2</bdi>.</cite></span>
</li>
<li id="cite_note-5"><span class="mw-cite-backlink"><b><a href="#cite_ref-5">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://www.w3.org/TR/SVG11/linking.html">"SVG specification: Linking"</a>. World Wide Web Consortium. 16 August 2011<span class="reference-accessdate">. Retrieved <span class="nowrap">24 June</span> 2019</span>.</cite></span>
</li>
<li id="cite_note-6"><span class="mw-cite-backlink"><b><a href="#cite_ref-6">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://www.w3.org/TR/SVG11/interact.html">"SVG specification: Interactivity"</a>. World Wide Web Consortium. 16 August 2011<span class="reference-accessdate">. Retrieved <span class="nowrap">24 June</span> 2019</span>.</cite></span>
</li>
</ol></div></div></div><!--htdig_noindex--><div><div class="zim-footer">
This article is issued from <a class="external text" title="Last edited on 2025-05-03" href="https://en.wikipedia.org/wiki/?title=Image_map&oldid=1288557784">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>
</body></html>